import torch
from torch import nn
import math
bias = nn.Parameter(torch.Tensor(1))
weight = nn.Parameter(torch.Tensor(2,10))
nn.init.normal_(weight, std=0.01)
fan_in, _ = nn.init._calculate_fan_in_and_fan_out(weight)
bound = 1 / math.sqrt(fan_in)
print(bound)
nn.init.uniform_(bias, -bound, bound)
print("weight",weight)
print("bias",bias) # 输入参数越多，初始化偏置越小。